package com.itheima.homework.homework1;

/**
 * @Author 王加鑫
 * @Date 2021/5/10 19:32
 * @Version 1.0
 */
public class Demo1 {
    public static void main(String[] args) {
        /*
        计算methodA方法执行了多长时间?
         */
        long start = System.currentTimeMillis();
//        methodA();
        forTets();
        long end = System.currentTimeMillis();
        System.out.println("methodA方法执行了:"+(end - start) + "毫秒");

    }

    public static void methodA(){
        int sum = 0;
        for (int i = 1; i <= 1000; i++) {
            if (i % 2 == 0) {
                sum += i;
            }
        }
        System.out.println("1-1000之间的偶数和为：" + sum);
    }

    public static void forTets(){
        for (int i = 0; i < 500; i++) {
            System.out.println(i);
        }
    }
}
